package com.mk.admin.service.impl;

import com.alibaba.fastjson2.JSONObject;
import com.mk.admin.model.ResultDto;
import com.mk.admin.model.query.*;
import com.mk.admin.model.vo.InHospitalAddBeInProofVo;
import com.mk.admin.model.vo.InHospitalAddBeInRegisterVo;
import com.mk.admin.model.vo.InHospitalProjectCancelVo;
import com.mk.admin.model.vo.InHospitalProjectConfirmVo;
import com.mk.admin.service.InHospitalService;
import com.mk.admin.util.HttpTool;
import org.springframework.stereotype.Service;

@Service
public class InHospitalServiceImpl implements InHospitalService {
    @Override
    public ResultDto byCardType(InHospitalByCardTypeQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0001", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto beInlist(InHospitalBeInlistQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0002", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto projectConfirm(InHospitalProjectConfirmVo vo) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0003", vo);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto projectCancel(InHospitalProjectCancelVo vo) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0004", vo);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto preparePayBalance(InHospitalPreparePayBalanceQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0005", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto preparePayRecord(InHospitalPreparePayRecordQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0006", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto diagnosis(InHospitalDiagnosisQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0009", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto prepareInProof(InHospitalPrepareInProofQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0010", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto advice(InHospitalAdviceQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0011", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto addBeInProof(InHospitalAddBeInProofVo vo) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0012", vo);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto addBeInRegister(InHospitalAddBeInRegisterVo vo) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0013", vo);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto diagnosisFeeDetail(InHospitalDiagnosisFeeDetailQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0014", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto outInDepartmentRecord(InHospitalOutInDepartmentRecordQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0015", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto operate(InHospitalOperateQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_1011", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }

    @Override
    public ResultDto outHospitalMedical(InHospitalOutHospitalMedicalQuery query) {
        JSONObject jsonObject = HttpTool.postJson("ipt_0031", query);
        Object result = jsonObject.get("result");
        if (result != null) {
            return ResultDto.data(result);
        }
        return ResultDto.data(jsonObject);
    }
}
